package com.huike.web.controller.Demo01_EasyExcel;

import com.alibaba.excel.EasyExcel;

import java.util.ArrayList;

/**
 * @author BossSkill
 * @ClassName: ExcelWrite
 * @date 2022/5/27 9:35
 * @Description:
 */
public class ExcelWrite {

    public static void main(String[] args) {

        String filePath = "C:\\Users\\Lenovo\\Desktop\\a.xlsx";

        ArrayList<Student> dataList = new ArrayList<>();
        dataList.add(new Student("测试",30));

//写入excel
//EasyExcel.write(哪个文件).sheet(哪张sheet表).head(表头什么样子).needHead(是否需要表头).doWrite(要写入的数据列表);
        EasyExcel.write(filePath).sheet(0).head(Student.class).needHead(true).doWrite(dataList);

    }

}
